Skip to content

Conversation

alexhafner
Copy link

This pull request addresses the issue in #1368 where we want to be able to use UnforgivingExecutionContext to deal with unexpected errors. The tests for UnforgivingExecutionContext are re-instated as they were before efc0353#diff-dc90fef2a8de7ab6853d36140a9149eef3342af69e7d5f95e34b3fe2a9a8ebe1, and a slightly adapted of the fix proposed by @weilu #1255 (comment) is implemented for UnforgivingExecutionContext itself. The modified version differentiates between GraphQLError, which it leaves to be handled by graphql-core and other errors, which it treats as unexpected and raises with the original error. This should also fix the tests failing per #1346.

error: GraphQLError,
return_type,
) -> None:
if type(error.original_error) is GraphQLError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our project, I had to change this to isinstance(error.original_error, GraphQLError).

We have a few subclasses of GraphQLError to support transformations from different data types using OurGraphQLError.from_other_error(...). This makes it easier to support extension's within the errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants